package com.crcode.crm;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.crcode.crm.utils.ConfigUtil;

@SuppressWarnings("deprecation")
@Configuration
public class RootSetting extends WebMvcConfigurerAdapter  {
	private String contextPath = ConfigUtil.getInstance().getProperty("contextPath");//虚拟目录访问路径
	private String realPath = ConfigUtil.getInstance().getProperty("realPath");//虚拟目录根目录
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		//addResourceHandler中的是访问路径，可以修改为其他的字符串
		//addResourceLocations中的是实际路径
		registry.addResourceHandler(contextPath).addResourceLocations(realPath);
		super.addResourceHandlers(registry);
	} 
}
